CC=g++
CFLAGS= -g -c -Wall -D__USE_FIXED_PROTOTYPES__ -D_REENTRANT
PROFILING= -pg
PROGRAM_NAME=../bin/tp1cn
EXE_NAME=tp1cn
CRIADOR=Vagner Clementino
OBJ=main.o Grafo.o Individuo.o IOManager.o MyMatrix.o \
	   ParametrosManager.o Populacao.o VerticesCandidatos.o
INPUTFILE=../files/SJC1.dat
OUTPUTFILE=../files/tpc1cn.log


# Compiler flags:
# -c -- Compile or assemble the source files, but do not link.
# -g -- Enable debugging
# -Wall -- Turn on all warnings 
# -D__USE_FIXED_PROTOTYPES__ -- Force the compiler to use the correct headers
# -ansi -- Don't use GNU extensions. Stick to ANSI C.
# -pg  -- enable profiling

all: msg_user linking
	@echo "Compilando o programa..."
	@rm -f $(OBJ) *.gch
	@echo "Compilação executada com sucesso."
	@echo "Para executar utilize o comando 'make run'"
run: tp1cn
	@echo "Executando o programa $(EXE_NAME)"
	@./$(PROGRAM_NAME) -i $(INPUTFILE) -o $(OUTPUTFILE)
msg_user:
	@echo "Executando o makefile do programa" \
	       "$(EXE_NAME) criado por $(CRIADOR)."
linking:$(OBJ)
	@$(CC) -o $(PROGRAM_NAME) $(OBJ) $(PROFILING)
	@echo "Linking executado com sucesso."

%.o: %.cpp %.h
	@$(CC) $(CFLAGS) $< -c $(PROFILING)

clean:
	@rm -f $(OBJ) *.gch $(PROGRAM_NAME)
